package com.ymatou.query.seller.trading.api.testcase;

import java.util.ArrayList;
import java.util.HashMap;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.seller.trading.api.service.ExistsSellerOrderListCall_seller;
import com.ymatou.query.trading.api.parameter.ExistsSellerOrderListBean;
import com.ymatou.query.trading.api.service.ExistsSellerOrderListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.common.enums.OrderDateEnum;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.ECode;

/**
 * 获取卖家订单数量 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_ExistsSellerOrderList {

	private static ExistsSellerOrderListBean existsSellerOrderListBean;
	private static ExistsSellerOrderListCall_seller existsSellerOrderListCall_seller;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取卖家订单数量");
	}

	@Before
	public void caseUp() {
		existsSellerOrderListBean = new ExistsSellerOrderListBean();
		existsSellerOrderListCall_seller = new ExistsSellerOrderListCall_seller();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(existsSellerOrderListCall_seller.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ExistsSellerOrderList_001() {
		Logger.start(true,"获取卖家闪购订单数量成功");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-3);
			existsSellerOrderListBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(1);
			existsSellerOrderListBean.setEndTime(EndTime);
			// 闪购 无用
			//existsSellerOrderListBean.setIsShangouOrder(false);
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			existsSellerOrderListBean.setLogisticsTypeList(LogisticsTypeList);
			// 订单时间类型
			existsSellerOrderListBean.setOrderDateEnum(OrderDateEnum.CreateDate.getValue());
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			OrderStatusList.add(1);
			OrderStatusList.add(2);
			OrderStatusList.add(3);
			//OrderStatusList.add(4);
			//OrderStatusList.add(12);
			//OrderStatusList.add(13);
			OrderStatusList.add(16);
			OrderStatusList.add(17);
			//OrderStatusList.add(101);
			existsSellerOrderListBean.setOrderStatusList(OrderStatusList);
			// 订单类型 1，2 为扫货，0 M 商品
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(1);
			OrderTypeList.add(2);
			existsSellerOrderListBean.setOrderTypeList(OrderTypeList);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			existsSellerOrderListBean.setOverTimeLimitDic(map);
			// 查询关键词
			//existsSellerOrderListBean.setSearchKeyWord("户外");
			//是否退款订单
			existsSellerOrderListBean.setSalesRefundOrderOnly(false);
			// 卖家ID
			existsSellerOrderListBean.setSellerId(SellerId);
			// seller 后台发送请求
			existsSellerOrderListCall_seller.setData(existsSellerOrderListBean);
			existsSellerOrderListCall_seller.callService();
			Logger.comment("existsSellerOrderListCall_seller send:" + existsSellerOrderListCall_seller.getEntityString());
			Logger.comment("existsSellerOrderListCall_seller response:" + existsSellerOrderListCall_seller.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, existsSellerOrderListCall_seller.getCode(), "验证Code");
			// user 后台发送请求
			ExistsSellerOrderListCall existsSellerOrderListCall=new ExistsSellerOrderListCall();
			existsSellerOrderListCall.setData(existsSellerOrderListBean);
			existsSellerOrderListCall.callService();
			Logger.comment("existsSellerOrderListCall send:" + existsSellerOrderListCall.getEntityString());
			Logger.comment("existsSellerOrderListCall response:" + existsSellerOrderListCall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, existsSellerOrderListCall.getCode(), "验证Code");
			//验证seller 后台跟user后台 同样请求返回数据一致		
			Logger.verifyEquals(existsSellerOrderListCall.getString("Data"),existsSellerOrderListCall_seller.getString("Data"), "验证seller 后台跟user后台 同样请求返回数据一致");				
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ExistsSellerOrderList_002() {
		Logger.start(true,"获取卖家非闪购订单数量成功");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-3);
			existsSellerOrderListBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(1);
			existsSellerOrderListBean.setEndTime(EndTime);
			// 闪购 无用
			//existsSellerOrderListBean.setIsShangouOrder(false);
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			existsSellerOrderListBean.setLogisticsTypeList(LogisticsTypeList);
			// 订单时间类型
			existsSellerOrderListBean.setOrderDateEnum(OrderDateEnum.CreateDate.getValue());
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			OrderStatusList.add(1);
			OrderStatusList.add(2);
			OrderStatusList.add(3);
			OrderStatusList.add(4);
			OrderStatusList.add(12);
			OrderStatusList.add(13);
			OrderStatusList.add(16);
			OrderStatusList.add(17);
			OrderStatusList.add(101);
			existsSellerOrderListBean.setOrderStatusList(OrderStatusList);
			// 订单类型  区分 1，2 为扫货，0 M 商品
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(0);
			existsSellerOrderListBean.setOrderTypeList(OrderTypeList);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			existsSellerOrderListBean.setOverTimeLimitDic(map);
			// 查询关键词
			//existsSellerOrderListBean.setSearchKeyWord("户外");
			//是否退款订单
			existsSellerOrderListBean.setSalesRefundOrderOnly(false);
			// 卖家ID
			existsSellerOrderListBean.setSellerId(SellerId);
			// seller 后台发送请求
			existsSellerOrderListCall_seller.setData(existsSellerOrderListBean);
			existsSellerOrderListCall_seller.callService();
			Logger.comment("existsSellerOrderListCall_seller send:" + existsSellerOrderListCall_seller.getEntityString());
			Logger.comment("existsSellerOrderListCall_seller response:" + existsSellerOrderListCall_seller.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, existsSellerOrderListCall_seller.getCode(), "验证Code");
			// user 后台发送请求
			ExistsSellerOrderListCall existsSellerOrderListCall=new ExistsSellerOrderListCall();
			existsSellerOrderListCall.setData(existsSellerOrderListBean);
			existsSellerOrderListCall.callService();
			Logger.comment("existsSellerOrderListCall send:" + existsSellerOrderListCall.getEntityString());
			Logger.comment("existsSellerOrderListCall response:" + existsSellerOrderListCall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, existsSellerOrderListCall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			//验证seller 后台跟user后台 同样请求返回数据一致		
			Logger.verifyEquals(existsSellerOrderListCall.getString("Data"),existsSellerOrderListCall_seller.getString("Data"), "验证seller 后台跟user后台 同样请求返回数据一致");				
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_ExistsSellerOrderList_003() {
		Logger.start(true,"获取卖家非闪购6个月前订单数量成功");
		try {
			int SellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			String BeginTime = YMTDateUtil.getBeforeOrNextDay(-183);
			existsSellerOrderListBean.setBeginTime(BeginTime);
			String EndTime = YMTDateUtil.getBeforeOrNextDay(1);
			existsSellerOrderListBean.setEndTime(EndTime);
			// 闪购 无用
			//existsSellerOrderListBean.setIsShangouOrder(false);
			// 物流类型
			ArrayList<Integer> LogisticsTypeList = new ArrayList<Integer>();
			existsSellerOrderListBean.setLogisticsTypeList(LogisticsTypeList);
			// 订单时间类型
			existsSellerOrderListBean.setOrderDateEnum(OrderDateEnum.CreateDate.getValue());
			// 订单状态
			ArrayList<Integer> OrderStatusList = new ArrayList<Integer>();
			OrderStatusList.add(1);
			OrderStatusList.add(2);
			OrderStatusList.add(3);
			OrderStatusList.add(4);
			OrderStatusList.add(12);
			OrderStatusList.add(13);
			OrderStatusList.add(16);
			OrderStatusList.add(17);
			OrderStatusList.add(101);
			existsSellerOrderListBean.setOrderStatusList(OrderStatusList);
			// 订单类型  区分 1，2 为扫货，0 M 商品
			ArrayList<Integer> OrderTypeList = new ArrayList<Integer>();
			OrderTypeList.add(0);
			existsSellerOrderListBean.setOrderTypeList(OrderTypeList);
			// 订单状态对应的超时时间
			HashMap<Integer, String> map = new HashMap<Integer, String>();
			existsSellerOrderListBean.setOverTimeLimitDic(map);
			// 查询关键词
			//existsSellerOrderListBean.setSearchKeyWord("户外");
			//是否退款订单
			existsSellerOrderListBean.setSalesRefundOrderOnly(false);
			// 卖家ID
			existsSellerOrderListBean.setSellerId(SellerId);
			// seller 后台发送请求
			existsSellerOrderListCall_seller.setData(existsSellerOrderListBean);
			existsSellerOrderListCall_seller.callService();
			Logger.comment("existsSellerOrderListCall_seller send:" + existsSellerOrderListCall_seller.getEntityString());
			Logger.comment("existsSellerOrderListCall_seller response:" + existsSellerOrderListCall_seller.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, existsSellerOrderListCall_seller.getCode(), "验证Code");
			// user 后台发送请求
			ExistsSellerOrderListCall existsSellerOrderListCall=new ExistsSellerOrderListCall();
			existsSellerOrderListCall.setData(existsSellerOrderListBean);
			existsSellerOrderListCall.callService();
			Logger.comment("existsSellerOrderListCall send:" + existsSellerOrderListCall.getEntityString());
			Logger.comment("existsSellerOrderListCall response:" + existsSellerOrderListCall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, existsSellerOrderListCall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			//验证seller 后台跟user后台 同样请求返回数据一致		
			Logger.verifyEquals(existsSellerOrderListCall.getString("Data"),existsSellerOrderListCall_seller.getString("Data"), "验证seller 后台跟user后台 同样请求返回数据一致");				
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}